package cn.e2win.base.entity;

import java.math.BigDecimal;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import cn.e2win.biz.security.UserSession;
import cn.e2win.biz.sys.Dict;
import cn.e2win.biz.util.StringUtils;

@Entity
@Table(name = "msg_logs")
public class MsgLogs extends BaseEntity {
	/**
	 * 
	 */

	public static final String	APP_ID			= "wxbbbdf18bcb0c9f90";
	
	private static final long serialVersionUID = 1L;

		//编号--结算单
		@Id
		@Basic(optional = false)
		@GeneratedValue(strategy = GenerationType.IDENTITY)
		@Column(name = "id", nullable = false)
		private Integer id;
		
		private Integer msgId;
		

		/**
		 * 发送类型，如消费记录， 生日祝福，到期提醒.等
		 */
		@Column(name="msgType")
		private String msgType;

		/**
		 * 发送方式 （微信，短信）
		 */
		private String sendWay;
		
		/**
		 * 发送条数，短信发送时一条可能被分为多条
		 */
		private Integer qty;
		
		private Integer custId;
		
		/**
		 * 微信时为openId,短信时为手机号
		 */
		private String toNo;
		
		private String msgTplId;

		@Column(length=1024)
		private String msgText;
		
		/**
		 * 发送状态
		 */
		private String msgStatus;
		
		private String relateObject;
		
		private Integer relatedId;

		@Transient
		private Integer smsQty;

		public MsgLogs() {
		}
		
		
		
		public Integer getId() {
			return id;
		}

		public void setId(Integer id) {
			this.id = id;
		}

		public String getMsgType() {
			return msgType;
		}

		public void setMsgType(String msgType) {
			this.msgType = msgType;
		}

		public String getSendWay() {
			return sendWay;
		}

		public void setSendWay(String sendWay) {
			this.sendWay = sendWay;
		}

		public Integer getQty() {
			return qty;
		}

		public void setQty(Integer qty) {
			this.qty = qty;
		}

		public Integer getCustId() {
			return custId;
		}

		public void setCustId(Integer custId) {
			this.custId = custId;
		}

		public Integer getMsgId() {
			return msgId;
		}
		public void setMsgId(Integer msgId) {
			this.msgId = msgId;
		}
		public String getToNo() {
			return toNo;
		}
		public void setToNo(String toNo) {
			this.toNo = toNo;
		}
		public String getMsgTplId() {
			return msgTplId;
		}

		public void setMsgTplId(String msgTplId) {
			this.msgTplId = msgTplId;
		}

		public String getMsgText() {
			return msgText;
		}
		public void setMsgText(String msgText) {
			this.msgText = msgText;
		}
		
		public String getMsgStatus() {
			return msgStatus;
		}

		public void setMsgStatus(String msgStatus) {
			this.msgStatus = msgStatus;
			if(StringUtils.isNumeric(msgStatus)){
				int qty = Integer.parseInt(msgStatus);
				if (qty>0){
					this.qty = qty;
				}else{
					this.qty=1;
				}
			}
		}

		public String getRelateObject() {
			return relateObject;
		}

		public void setRelateObject(String relateObject) {
			this.relateObject = relateObject;
		}

		public Integer getRelatedId() {
			return relatedId;
		}

		public void setRelatedId(Integer relatedId) {
			this.relatedId = relatedId;
		}
		public Integer getSmsQty() {
			return smsQty;
		}
		public void setSmsQty(Integer smsQty) {
			this.smsQty = smsQty;
		}
}
